<%--
    Document   : index
    Created on : Jul 29, 2011, 10:53:41 PM
    Author     : phuc
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %>

<%
    BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
%>


<html>
    <head>
        <title>Upload Test</title>
        <script type="text/javascript">
            function getFileName(fName)
            {
                fullName = fName;
                shortName = fullName.match(/[^\/\\]+$/);
                document.forms.Frm1.foo.value = shortName;
                //alert(shortName);
                opener.document.form1.fname.value = shortName;
            }
        </script>
    </head>
    <body>
        <form action="<%= blobstoreService.createUploadUrl("/upload") %>" name="Frm1" method="post" enctype="multipart/form-data">
            <input type="hidden" name="foo">
            <input type="file" id="f_name" name="myFile" onchange="getFileName(this.value);" >
            <input type="submit" value="Submit" onclick="javascipt: window.close();">
        </form>
    </body>
</html>
